package com.sca.deal.service.impl;

import com.sca.deal.order.dao.OrderDao;
import com.sca.deal.order.entity.Order;
import com.sca.deal.product.dao.ProductDao;
import com.sca.deal.product.entity.Product;
import com.sca.deal.service.DealService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class DealServiceImpl implements DealService {

    @Resource
    private ProductDao productDao;

    @Resource
    private OrderDao orderDao;

    @Override
    public int create(Order order) {
        Product p = new Product();
        p.setName(order.getProductId().toString());
        p.setTotal(order.getCount());
        productDao.create(p);

        return orderDao.create(order);
    }

    @Override
    public Order searchByid(Long id) {
        return null;
    }
}
